package com.shioirikukuri.mapper;

import com.shioirikukuri.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CustomerMapper {
	/**
	 * 根据手机号查询用户
	 */
	@Select("SELECT * FROM users WHERE phone_number = #{phoneNumber}")
	User findByPhoneNumber(@Param("phoneNumber") String phoneNumber);

	/**
	 * 根据手机号查询消费者用户
	 * @param phoneNumber
	 * @return
	 */
	@Select("SELECT * FROM users WHERE phone_number = #{phoneNumber} AND role = 'CONSUMER'")
	User findConsumerByPhoneNumber(@Param("phoneNumber") String phoneNumber);

}
